﻿using Domain.Entities;
using Domain.IRepositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Application.ReplyApp
{
    public class ReplyAppService : IReplyAppService
    {

        //用户管理仓储接口
        private readonly IReplyRepository _repository;

        /// <summary>
        /// 构造函数 实现依赖注入
        /// </summary>
        /// <param name="ReplyRepository">仓储对象</param>
        public ReplyAppService(IReplyRepository ReplyRepository)
        {
            _repository = ReplyRepository;
        }

        public Reply GetById(Int32 id)
        {
            return _repository.GetById(id);
        }

        public List<Reply> GetAll(string key, string pid)
        {
            return _repository.GetAll(key,pid).ToList();
        }

        public List<Reply> GetPageList(string userId, string disable, string SearchKeyWords, int PageSize, int PageCurrent, string OrderField, bool OrderDirection = true)
        {
            return _repository.GetPageList(userId, disable, SearchKeyWords, PageSize, PageCurrent, OrderField, OrderDirection).ToList();
        }

        public bool AddOrUpdate(Reply model)
        {
            return _repository.AddOrUpdate(model);
        }

        public bool DeleteById(int id)
        {
            return _repository.DeleteById(id);
        }
    }
}
